#!/bin/bash
pushd ../binaries

#Declare some variables:
#on Mac:
adt_directory="/Applications/Adobe Flash Builder 4.6/sdks/4.6.0/bin"

cert_directory="../certificates"
provisioning_profile=${cert_directory}/YourProfileHere.mobileprovision
developer_identity=${cert_directory}/YourKeyHere.p12

platformSDK_directory="/Developer/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk"

app_bin_directory="../FlexApp"

extension_directory="."

dest_ipa=TestEmailApp.ipa

app_config_file=TestEmailApp-app.xml

swf_file=TestEmailApp.swf

logo_directory="${app_bin_directory}"/src/assets

#Clean up the terrain from old packages:
rm -f "${dest_ipa}"
rm -f *.swf
rm -f *.xml
rm -f -r *.dSYM

#Copy the ingredients for the package:
cp -f "${app_bin_directory}"/bin-debug/TestEmailApp.swf .
cp -f "${app_bin_directory}"/bin-debug/TestEmailApp-app.xml .
cp -f -r "${logo_directory}" .


"${adt_directory}"/adt -package -target ipa-debug-interpreter -storetype pkcs12 -keystore "${developer_identity}" -provisioning-profile "${provisioning_profile}" "${dest_ipa}" "${app_config_file}" "${swf_file}" -platformsdk "${platformSDK_directory}" -extdir "${extension_directory}" assets

popd

